<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>an-link | an-ui</title>
    <style>
        html {
            box-sizing: border-box;
        }

        *,
        *:before,
        *:after {
            box-sizing: inherit;
        }

        html:focus {
            outline: none;
        }

        *:focus {
            outline: inherit;
        }
    </style>
    <link rel="stylesheet" href="style.css">
    <script type="module" src="/modal/modal.js"></script>
</head>

<body>
    <div style="z-index: 90000;position: relative;">
        <button id="btn1">打开 modal</button>
        <button id="btn2">打开 alert</button>
        <button id="btn3">打开 success</button>
        <button id="btn4">打开 error</button>
        <button id="btn5">打开 confirm</button>
    </div>

    <an-modal hidden
        id="anModal"
        title="<h2 title='提示'>提示</h2>"
        close-text="关闭"
        backdrop
        closeable
        update-zindex>
        我是内容我是内容我是内容我是内容我是内容我是内容我是内容我
        是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容
    </an-modal>
    <script type="module">
        import { Modal } from '/modal/modal.js'
        btn1.addEventListener('click', () => {
            anModal.open = true
        })
        anModal.onclose = function (e) {
            console.log(e)
        }
        anModal.onok = function (e) {
            console.log(e)
        }
        btn2.addEventListener('click', () => {
            Modal.alert({
                // title: 'Alert',
                content: 'Alert Content'
            })
        })
        btn3.addEventListener('click', () => {
            Modal.success({
                // title: 'Success',
                content: 'Success Content'
            })
        })
        btn4.addEventListener('click', () => {
            Modal.error({
                // title: 'Error',
                content: 'Error Content'
            })
        })
        btn5.addEventListener('click', () => {
            Modal.confirm({
                // title: 'Confirm',
                content: 'Confirm Content'
            })
        })
    </script>
</body>

</html>